<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="button" value="JsonP" onclick="getJSONP()">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    <script>
        // function getJSONP() {
        //     $.getScript("http://localhost:3000/html/1.php?m=m3",function (bak) {
        //         console.log(bak);
        //     })
        // }

        function showData(data) {
            console.log(data);
        }

        // function getJSONP() {
        //     var request = new XMLHttpRequest();
        //     request.onreadystatechange=function(){
        //         if(request.readyState==4 && request.status==200){
        //             console.log(request.responseText);
        //         }
        //     }
        //     request.open("GET","http://localhost:3000/html/1.php?m=m3");
        //     request.send();
        // }
        let res;
        function getJSONP() {
            var ele = document.createElement("script");
            ele.src = "http://localhost:3000/html/1.php?m=m4";
            document.body.appendChild(ele);
            ele.onload = function () {
                console.log(res);
            }
        }

    </script>
    <!-- <script src="http://localhost:3000/html/1.php?m=m3"></script> -->
</body>

</html>